package com.fenghongzhang.day005;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import android.os.Bundle;
import android.widget.TextView;

public class Main2Activity extends AppCompatActivity implements SendFragment.SendListener {
    private TextView tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);


        tv = (TextView) findViewById(R.id.tv);

        //动态加载fg
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
        fragmentTransaction.add(R.id.ll,new SendFragment());
        fragmentTransaction.commit();
    }

    @Override
    public void send(String s) {
        tv.setText(s);
    }
}
